package com.hz.zbl.service.impl;

import com.hz.zbl.mapper.CourseMapper;
import com.hz.zbl.model.entity.CourseEntity;
import com.hz.zbl.service.CourseService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class CourseServiceImpl implements CourseService {
    @Resource
    CourseMapper courseMapper;

    @Override
    public int addCourse(String course_name, String course_code, String teacehr_realname, int teacher_user_id, int section_count, String course_time,
                         int max_student_count, String course_profile, String textbook, int credits_count, int all_score, int pass_score,
                         int current_section_count, int course_year, int course_semester, String course_room) {

        CourseEntity courseEntity = new CourseEntity();

        courseEntity.setCourse_name(course_name);
        courseEntity.setCourse_code(course_code);
        courseEntity.setTeacher_realname(teacehr_realname);
        courseEntity.setTeacher_user_id(teacher_user_id);
        courseEntity.setSection_count(section_count);
        courseEntity.setCourse_time(course_time);
        courseEntity.setMax_student_count(max_student_count);
        courseEntity.setCourse_profile(course_profile);
        courseEntity.setTextbook(textbook);
        courseEntity.setCredits_count(credits_count);
        courseEntity.setAll_score(all_score);
        courseEntity.setPass_score(pass_score);

        courseEntity.setCurrent_section_count(current_section_count);
        courseEntity.setCourse_year(course_year);
        courseEntity.setCourse_semester(course_semester);

        courseEntity.setCourse_room(course_room);
        return courseMapper.addCourse(courseEntity);
    }
}
